package com.szxx.constant;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.szxx.domain.Card;
import com.szxx.domain.CardShape;
import com.szxx.domain.DdzCard;

/**
 * Created by Martin on 2017/6/22.
 */
public class DdzCardConstant {

    /** 默认桌子最多人数 */
    public static int DEFAULT_PLAYERCOUNTDEFINITION = 3;
    
    /** 斗地主3的value值标记起始点 */
    public static int NUMBER_3_VALUE = 3;

    /** 单花色13张，K值，用于分界A，2的牌值 */
    public static int SINGLE_SHAPE_MAX_NUM = 13;
    
    /** 斗地主A的value值 */
    public static int NUMBER_1_VALUE = SINGLE_SHAPE_MAX_NUM + 1;
    
    /** 斗地主2的value值 */
    public static int NUMBER_2_VALUE = SINGLE_SHAPE_MAX_NUM + 2;
    
    /** 小王点数 */
    public static int BLACK_JOKER_SHAPE_NUM = SINGLE_SHAPE_MAX_NUM + 3;
    
    /** 小王的value值 */
    public static int BLACK_JOKER_SHAPE_VALUE = SINGLE_SHAPE_MAX_NUM + 3;

    /** 大王点数 */
    public static int RED_JOKER_SHAPE_NUM = SINGLE_SHAPE_MAX_NUM + 4;
    
    /** 大王的value值 */
    public static int RED_JOKER_SHAPE_VALUE = SINGLE_SHAPE_MAX_NUM + 4;
    
    /** 斗地主系统牌 */
    public static final List<Card> MODEL_CARDS = new ArrayList<Card>();
    
    static {
    	for (int i = 1; i <= SINGLE_SHAPE_MAX_NUM ; i++) {
    		MODEL_CARDS.add(new DdzCard(CardShape.DIAMOND, i).revalue());
    		MODEL_CARDS.add(new DdzCard(CardShape.CLUB, i).revalue());
    		MODEL_CARDS.add(new DdzCard(CardShape.HEART, i).revalue());
    		MODEL_CARDS.add(new DdzCard(CardShape.SPADE, i).revalue());
		}
    	MODEL_CARDS.add(new DdzCard(CardShape.BLACK_JOKER, 0).revalue());
    	MODEL_CARDS.add(new DdzCard(CardShape.RED_JOKER, 0).revalue());
    	for (Card card : MODEL_CARDS) {
			if (card.getValue() == 0 || card.getNumber() == 0) {
				System.out.println(card.getCardShape() + "-" + card.getNumber() + "-" + card.getValue());
			}
		}
    }
    
    /**
     * 获取系统牌 <br>
     * 每张牌都是深克隆的
     * 
     * @return
     */
    public static List<Card> getSystemCards() {
    	List<Card> cardsCopy = new ArrayList<Card>();
    	for (Card card : Collections.unmodifiableList(MODEL_CARDS)) {
    		cardsCopy.add(card.clone());
		}
		return cardsCopy;
    }
    
}
